<template>
  <div>
    <!-- 动画效果！！！ -->
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition name="hello" appear>
      <h1 v-show="isShow">你好啊</h1>
    </transition>
  </div>
</template>

<script>
export default {
  name:'MyTest',
  data () {
    return {
      isShow:true
    }
  }
}
</script>

<style scoped>
  h1{
    background-color: orange;
  }

  /* v-enter-active和v-leave-active是默认值，如果给transition标签设置了name，就无法使用默认的v-开头 */
  /* .v-enter-active{
    animation: demo 1s;
  }
  .v-leave-active{
    animation: demo 1s reverse;
  } */
  .hello-enter-active{
    animation: demo 1s;
  }
  .hello-leave-active{
    animation: demo 1s reverse;
  }
  @keyframes demo {
    from{
      transform: translateX(-100%);
    }
    to{
      transform: translateX(0px);
    }
  }
</style>